{template header}
<div class="console-title">
    <h2>企业信息列表</h2>
</div>
<div class="content-div">
    <form method="post" id="listForm" autocomplete="off">
        <input type="hidden" name="formsubmit" value="yes">
        <input type="hidden" name="formhash" value="{FORMHASH}">
        <table cellspacing="0" cellpadding="0" width="100%" class="listtable">
            <thead>
            <tr>
                <th>选?</th>
                <th>LOGO</th>
                <th>企业名称</th>
                <th>所属分类</th>
                <th>营业执照</th>
                <th>联系人</th>
                <th>联系电话</th>
                <th>所在地</th>
                <th>创建时间</th>
                <th>选项</th>
            </tr>
            </thead>
            <tbody>
            {loop $companylist $company}
            <tr>
                <td><input type="checkbox" class="checkbox checkmark itemCheckBox" title="" name="delete[]" value="{$company[company_id]}"></td>
                <td><img src="{img $company[company_logo]}" width="50" height="50"></td>
                <td>{$company[company_name]}</td>
                <td>{$catloglist[$company[catid]][name]}</td>
                <td>{$company[company_license_no]}</td>
                <td>{$company[contact]}</td>
                <td>{$company[tel]}</td>
                <td>{$company[province]} {$company[city]} {$company[county]} {$company[street]}</td>
                <td>{date:$company[create_time]|'Y-m-d H:i:s'}</td>
                <td><a href="{U:('c=company&a=edit&company_id='.$company[company_id])}">编辑</a></td>
            </tr>
            {/loop}
            </tbody>
            <tfoot>
            <tr>
                <td colspan="10">
                    <div class="pagination float-right">{$pagination}</div>
                    <label><input type="checkbox" class="checkbox checkall"> 全选</label>
                    <label><button class="btn" type="button" id="deleteButton">删除</button></label>
                    <label><button class="btn" type="button" data-action="refresh">刷新</button></label>
                </td>
            </tr>
            </tfoot>
        </table>
    </form>
</div>
<script type="text/javascript">
    $(function () {
        $("#deleteButton").on('click', function () {
            if($(".itemCheckBox:checked").length === 0){
                DSXUI.error('请选择要删除的选项');
                return false;
            }

            DSXUI.showConfirm('删除企业', '确认要删除所选企业企业吗?', function () {
                //$("#listForm").submit();
                var spinner = null;
                $("#listForm").ajaxSubmit({
                    dataType:'json',
                    beforeSend:function () {
                        spinner = DSXUI.showSpinner();
                    },success:function (response) {
                        setTimeout(function () {
                            spinner.close();
                            if (response.errcode === 0){
                                DSXUtil.reFresh();
                            }else {
                                DSXUI.error('删除失败');
                            }
                        }, 500);
                    }
                });
            });
        });
    });
</script>
{template footer}